<include file="Public:_head" />
<include file="Public:left" />
	<script type="text/javascript" charset="utf-8" src="com_statics/ueditor/wx_ueditor.config.js"></script>
	<script type="text/javascript" charset="utf-8" src="com_statics/ueditor/ueditor.all.min.js"> </script>
	<script type="text/javascript" src="com_statics/js/ajaxfileupload.js"></script>
	<div id="neirong">
 		<!--<h2 class="lm_title">单图文消息</h2>-->
            <div id="AddDoc">
                 <h3 class="subTitle"><img src="com_statics/images/icon_3.gif" alt="图片描述" style="left:9px;"/>单图文消息<span>添加单条图文消息</span></h3>
                <div id="DocPreview">
                    <h3 id="demo_title">{$reply.content.title}</h3>
                    <div class="pic">
                    <img id="demo_img_url" src="{$reply.content.pic.url}" alt="图片描述" />
                    </div>
                    <p id="demo_description">{$reply.content.description}</p>
                </div>
                <!-- DocPreview结束 -->
				<form name="form" method="post" action="{:U('save_reply_image_simple',array('reply_id'=>$reply['reply_id']))}" onSubmit="return checkreply();">
                <div id="AddDocForm">
					<div id="formElement_top" class="adddocform">
                    <dl>
                        <dt>关键字（多个关键字用空格隔开）<font color="red">*</font>：</dt>
                        <dd><div class="border"><input name="key" type="text" class="text" value="{$reply.key}" /></div> <span class="xuanxian"><input name="fuzzy" type="radio" value="1" <if condition="$reply.fuzzy eq 1">checked</if> /> 模糊匹配 </span>
                        <span class="clear"></span>
                        </dd>
                        <dt>标题 <font color="red">*</font>：</dt>
                        <dd><div class="border"><input name="title" type="text" class="text" id="title" value="{$reply.content.title}" /></div>
                        <span class="clear"></span>
                        </dd>
                        <dt>作者：</dt>
                        <dd><div class="border"><input name="author" type="text" class="text" value="{$reply.content.author}" /></div>
                        <span class="clear"></span>
                        	<div class="uploadbox">
                               <p> 封面<span>（大图片建议尺寸：900像素*500像素）<font color="red">*</font></span></p>
								<div class="img_preview">
									<img src="{$reply.content.pic.url}" id="img_url" width="300" height="167" /><p><a href="javascript:void(0)" class="imgdel">删除</a></p>
									<input name="picaid" id="picaid" type="hidden" value="{$reply.content.picaid}" />
								</div>
								<div class="img_upload" style="display:none">
									<input type="file" id="fileToUpload" name="fileToUpload" style="display:none">
									<a href="javascript:void(0)" id="clickupload" class="btn_upload">上传</a>
								</div>
                            </div>
                        </dd>
                        <dt>摘要：</dt>
                        <dd><div class="border"><textarea name="description" id="description" cols="" rows="">{$reply.content.description}</textarea></div>
                        <span class="clear"></span>
                        </dd>
                        <dt>正文 <font color="red">*</font>：</dt>
                        <dd>
                        	<script id="content" name="content" type="text/plain" style="width:400px;height:300px">{$reply.content.content}</script>
                        </dd>	
                    	<dt>链接：</dt>
                        <dd><div class="border"><input name="url" type="text" class="text" style="width:389px;" value="{$reply.content.url}" /></div> <span class="clear"></span></dd>
                        <dd>
                     <button class="btn_send"  type="submit">提交</button></dd>
                    </dl>
					<span class="jiantou"></span>
					</div>
                </div>
				</form>
                <!-- AddDocForm结束 -->
                <span class="clear"></span>
                <!-- 清除浮动 -->
            </div>
            <!-- AddDoc结束 -->
	</div>
	<!-- neirong结束 -->
	<span class="clear"></span>
	<!-- 清除浮动 -->
</div>
<!-- container结束 -->
<script>
function checkreply(){
	var a = $("input[name='key']").attr('value');
	var b = $("input[name='title']").attr('value');
	var c = $("input[name='picaid']").attr('value');
	var d = $("textarea[name='content']").attr('value');
   if(a ==""){
        alert('关键字不能为空！');
        return false;
    }
    if(b ==""){
        alert('标题不能为空！');
        return false;
    }
    if(c ==""){
        alert('封面不能为空！');
        return false;
    }
    if(d ==""){
        alert('正文不能为空！');
        return false;
    }
}
	$(document).ready(function(){
		var ue = UE.getEditor('content');
		$("#clickupload").click(function(){
			$("#fileToUpload").click();
		});
		$("#fileToUpload").live('change',function(){
			$.ajaxFileUpload(
				{
					url:"__URL__/uploadpic",
					secureuri:false,
					fileElementId:'fileToUpload',
					dataType: 'json',
					data:{type:'weixin'},
					success: function (res){
						$(".img_upload").hide();
						$("#img_url").attr('src',res.info.url);
						$("#demo_img_url").attr('src',res.info.url);
						$("#picaid").val(res.aid);
						$(".img_preview").show();
					},
					error: function (res){
						alert(res);
					}
				}
			)
		});
		$("#title").keyup(function(){
			title_val = $("#demo_title").val();
			if(title_val == '这是标题'){
				title = '';
			}else{
				title = title_val;
			}
			$("#demo_title").html(title+$("#title").val());
		});
		$("#description").keyup(function(){
			description_val = $("#demo_description").val();
			if(description_val == '这是摘要'){
				description = '';
			}else{
				description = description_val;
			}
			$("#demo_description").html(description+$("#description").val());
		});
		$(".imgdel").click(function(){
			$(".img_preview").hide();
			$(".img_upload").show();
			$("#demo_img_url").attr('src','');
		});
	});
</script>
<include file="Public:bottom" />